From: Keir Fraser Date: Fri, 23 Oct 2009 09:13:52 +0000 (+0100) Subject: x86 ept: ignore guest writes to read only memory regions or memory X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13177 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=d6d3c05250536f81aa988207fc83c4a3a7cccb6a;p=xen.git x86 ept: ignore guest writes to read only memory regions or memory holes in EPT. This patch prevents domain crash when running memtest86 with EPT. Signed-off-by: Xin Li --- diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index e187677dd3..d85b3d877b 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2184,6 +2184,17 @@ static void ept_handle_violation(unsigned long qualification, paddr_t gpa) return; } + /* Ignore writes to: + * 1. read only memory regions; + * 2. memory holes. */ + if ( (qualification & EPT_WRITE_VIOLATION) + && (((gla_validity == EPT_GLA_VALIDITY_MATCH) && (t == p2m_ram_ro)) + || (mfn_x(mfn) == INVALID_MFN)) ) { + int inst_len = __get_instruction_length(); + __update_guest_eip(inst_len); + return; + } + /* Everything else is an error. */ gla = __vmread(GUEST_LINEAR_ADDRESS); gdprintk(XENLOG_ERR, "EPT violation %#lx (%c%c%c/%c%c%c), "